1. Field
The following description relates to a method and apparatus for calculating the number of leading zero bits of a binary operation, and in addition, to a method and apparatus for calculating the number of leading zero bits algebraically by a binary operation that uses a binary tree structure.
2. Description of the Related Art
A leading zero anticipator (LZA) predicts the location of an initial ‘1’ bit from the most significant bit (MSB) of a result of an addition or a subtraction of two input binary operands. In the case of addition or subtraction of normalized binary numbers, a result of an operation requires a shift of bits for normalization. In this case, the LZA may expedite an operation by predicting the bit shift simultaneously while performing the addition and/or subtraction operations.
In a floating-point addition or subtraction, a leading bit of ‘1’ needs to be shifted to the most significant bit for normalization. For this bit shift, the number of ‘0’ bits preceding the bit ‘1’ are detected in the addition or subtraction result, and the bit shift is performed for the number of ‘0’ bits. In this example, the LZA reduces a critical path delay by obtaining the location of the leading ‘1’ bit and the number of ‘0’ bits that are necessary for the bit shift at the same time that the addition or subtraction operation is performed.
The general LZA may produce an inaccurate prediction result if an error in the accurate digit location of the leading ‘1’ bit is present. For example, the error may be caused by a carry from a lower bit that is not taken into consideration, and the prediction is performed in a direction from an upper bit to a lower bit of an input in implementation of an LZA. In addition, the general LZA may make accurate prediction by calculating the prediction result in parallel while taking into consideration the carry occurrence from a lower bit. However, in this example, the overall operation procedures increase complexity and overall operation time delay may occur.